package controller;

import java.util.Date;
import java.util.Set;

import dao.DaoException;

import model.Activitate;
import model.Sponsor;



import service.AdministratorService;
import service.ServiceException;

@SuppressWarnings("unused")
public class AdministratorController {
	private AdministratorService adminService;

	public AdministratorService getAdminService() {
		return adminService;
	}

	public void setAdminService(AdministratorService adminService) {
		this.adminService = adminService;
	}
	
	public Set<Sponsor> getSponsori(){
		return adminService.getSponsori();
	}
	public void addSponsor(String nume, Integer suma,String adresa, String telefon,  String cnp){
		adminService.addSponsor(nume, suma, adresa, telefon, cnp);
	}
	public void removeSponsor(int id) throws ServiceException {
		adminService.removeSponsor(id);
	}
	public void updateSponsor(int id,String nume, Integer suma,String adresa, String telefon,  String cnp) throws ControllerException {
		
		Sponsor s=this.getSponsorById(id);
		s.setNume(nume);
		s.setSuma(suma);
		s.setAdresa(adresa);
		s.setTelefon(telefon);
		s.setCnp(cnp);
		adminService.updateSponsor(s);
		
	}
		
	
	public Sponsor getSponsorById(int id)throws ControllerException {
		try {
			return adminService.getSponsorById(id);
		} catch (ServiceException e) {
            throw new ControllerException(e.getMessage(), e);
        }
	}
	
	public Set<Activitate> getAllActivitati(){
		return adminService.getActivitati();
	}
	public void addActivitate(String denumire, Date data, String locatie) {
		adminService.addActivitate(denumire, data, locatie);
	}
	public void removeActivitate(int id) throws ServiceException{
		adminService.removeActivitate(id);
	}
	
	
}
